<script language="javascript" type="text/javascript">
    function closeGeo(id){
        $("#"+id).slideUp();
    }
    function orderPropertyByPrice(){
        document.formOrderPropertyByPrice.submit();
    }
    function search (){
        $('#frmSearch').submit();
    }
</script>
<?php
$rsProperty = listAllPropertyByGeo($param[1]);
$rsCat=getGeoInfoBylink($param[1]);
?>
<div class="right_content_SBDS">
     <div class="toplink"><img src="/images/iconhome.gif" /><a href="#"><b>Trang chủ</b></a>&raquo;<a href="#">Sản phẩm giao dịch</a>&raquo;<a href="#" class="pagehere"><?php echo $rsCat["cat_title"];?></a></div>
    <div class="top_san_BDS">
        <div class="top_san_BDS_l">
            Xem tin ở tỉnh thành khác: <span id="propertyCityLink"><font class="textbold">Tỉnh thành</font><img src="/images/arrow6.gif" /></span>
            <div id="ShowAllCities" style="display:none;">
                <div class="close"><a href="javascript: closeGeo('ShowAllCities');"><img src="/images/close.gif" /></a></div>
                              <div class="content_form">
                    <div class="item1">
                       <?php
                            $allCity = getAllCityByParent('1');
                            $i=0;
                            while($row = $db->fetch_array($allCity)){
                                $i++;
                                if($i==1 || $i==2){
                                    echo '<a href="'.get_link("property","geo",$row['geo_link']).'"><b>'.$row['geo_title'].'</b></a><br />';
                                }else{
                                    echo '<a href="'.get_link("property","geo",$row['geo_link']).'">'.$row['geo_title'].'</a><br />';
                                }
                            }
                        ?>
                    </div>

                    <div class="item1">
                         <?php
                            $allCity = getAllCityByParent('2');
                            $i=0;
                            while($row = $db->fetch_array($allCity)){
                                $i++;
                                if($i==1 || $i==2){
                                    echo '<a href="'.get_link("property","geo",$row['geo_link']).'"><b>'.$row['geo_title'].'</b></a><br />';
                                }else{
                                    echo '<a href="'.get_link("property","geo",$row['geo_link']).'">'.$row['geo_title'].'</a><br />';
                                }
                            }
                        ?>
                    </div>

                    <div class="item1">
                         <?php
                            $allCity = getAllCityByParent('3');
                            $i=0;
                            while($row = $db->fetch_array($allCity)){
                                $i++;
                                if($i==1 || $i==2){
                                    echo '<a href="'.get_link("property","geo",$row['geo_link']).'"><b>'.$row['geo_title'].'</b></a><br />';
                                }else{
                                    echo '<a href="'.get_link("property","geo",$row['geo_link']).'">'.$row['geo_title'].'</a><br />';
                                }
                            }
                        ?>
                    </div>

                </div>
            </div>
            <p>Có <font class="textbold"><?php echo $rsProperty['totalProperty'];?></font> tin trong mục <font class="textbold"><?php echo $rsProperty['catTitle'];?></font></p>

        </div>


    </div>
    <div class="Right_san_ct">

        <div class="main_san_BDS_left">
            <div class="main_san_BDS_l">
                <div class="main_san_BDS_l_top">
                    <form action="" method="post" name="formOrderPropertyByPrice">
                        <div class="BDS_l_top_l">
                            <b style="float:left">Sắp xếp:&nbsp;&nbsp;&nbsp;</b>
                            <select name="orderPrice" id="orderPrice" onchange="orderPropertyByPrice();">
                                <option <?php echo setSelectedBoxValue($_SESSION['orderPrice'],1);?> value="1">[Giá (Thấp đến cao)]</option>
                                <option <?php echo setSelectedBoxValue($_SESSION['orderPrice'],2);?> value="2">[Giá (Cao đến thấp)]</option>
                            </select>
                        </div>
                    </form>
                    <?php
                    if($rsProperty["totalPages"]>1) {
                        ?>
                    <div class="BDS_l_top_r">
                        <ul>
                            <li>
                                <?php echo paging_small($rsProperty["page"],$rsProperty["totalPages"],get_link_page('property','cat',$rsProperty["catLink"]));?>
                            </li>
                            <li>Trang <?php echo $rsProperty["page"];?>/<?php echo $rsProperty["totalPages"];?></li>
                        </ul>
                    </div>
                    <?php
                }
                ?>
                </div>
                <div class="linechothue">
                    <ul>
                        <?php
                        $i=0;
                        while($arrProperty=$db->fetch_array($rsProperty['rs'])) {
                        $i++;
                            ?>
                        <li>
                            <div class="imagechothue"><img src="<?php echo get_property_thumb($arrProperty['thumb'],'110-100');?>"/></div>
                            <div class="infochothue">
                                <h2><a href="<?php echo get_link("property","detail",$arrProperty['title_link']); ?>" title="<?php echo htmlentities_utf8($arrProperty['title']);?>"><?php echo cutString($arrProperty['title'], 70) ;?></a></h2>
                                <br><div style="font-size:12px; "><?php echo limitWord($arrProperty['description'], 18);?></div>
                                <div class="list1"><img src="/images/point.gif" />Loại BĐS: <a href="<?php echo get_link("property","cat",$arrProperty["cat_link"]);?>" title="<?php echo $arrProperty["cat_title"];?>"><?php echo $arrProperty["cat_title"];?></a></div>
                                <div class="list1"><img src="/images/point.gif" />Ngày đăng: <?php echo get_my_date($arrProperty["create_date"],'d/m/Y');?></div>
                                <div class="linksave" style="margin-top: 8px;"><div style="float: left; width: 308px;"><img src="/images/luu.gif" /><a href="#">Lưu</a><a href="#">l</a><img src="/images/chitiet.gif" /><a href="<?php echo get_link("property","detail",$arrProperty['title_link']); ?>" title="<?php echo htmlentities_utf8($arrProperty['title']);?>">Chi tiết</a></div><div style="float: right; width: 40px;">&nbsp;</div></div>
                            </div>
                            <div class="pricediv" style="width:250px">

                                <table cellpadding="5" cellspacing="0" width="100%" rules="none" >

                                        <tr style="background-color: #c8dff3;color:#000; font-weight: bold;">
                                            <td width="90px">Tổng giá</td>
                                            <td width="80px">Theo m2</td>
                                            <td  class="money"><a  style="color: #FFF;" href="javascript: void(0);">&nbsp;</a></td>
                                        </tr>
                                        <tr>
                                            <td  ><div id="showPriceTotalVND<?php echo $i;?>" style="color: red;font-weight: bold"><?php $totalPrice = $arrProperty['price']*$arrProperty['area_build']; if($totalPrice){echo get_price_string($totalPrice);}else{echo 'N/A';}?><input type="hidden" id="priceTotal<?php echo $i;?>" value="<?php echo $totalPrice;?>"/></div><div id="showPriceTotalUSD<?php echo $i;?>" style="color: red;font-weight: bold"></div></td>
                                            <td  ><div id="showPriceM2VND<?php echo $i;?>" style="color: red;font-weight: bold"><input type="hidden" id="priceM2<?php echo $i;?>" value="<?php echo $arrProperty['price'];?>"/><?php echo get_price_string($arrProperty['price']);?></div><div id="showPriceM2USD<?php echo $i;?>" style="color: red;font-weight: bold"></div></td>
                                            <td  class="money">
                                                <div><a id="txtPriceVND<?php echo $i;?>" href="javascript: void(0);" onclick="priceExchange(<?php echo $i;?>,'vnd');">VNĐ</a><img src="<?php echo SITE_IMAGES_URL; ?>/icon_check.gif" id="imgVND<?php echo $i;?>"></div>
                                                <div><a id="txtPriceUSD<?php echo $i;?>" href="javascript: void(0);" onclick="priceExchange(<?php echo $i;?>,'usd');">USD</a><img src="<?php echo SITE_IMAGES_URL; ?>/icon_check.gif" style="display: none" id="imgUSD<?php echo $i;?>"></div>
                                            </td>
                                        </tr>

                                </table>

                            </div>
                        </li>
                        <?php } ?>
                    </ul>

                    <script language="javascript" type="text/javascript">
                        var usdForexs = vCosts[0];
                        //var usdForexs = 19.070;
                        function format_number(dec,fix) {
                        fixValue = parseFloat(Math.pow(10,fix));
                        retValue = parseInt(Math.round(dec * fixValue)) / fixValue;
                        return retValue;
                        }
                        function priceExchange(htmlIdIndex,type){
                            if(type=='usd'){
                                var totalUSD = ($('#priceTotal'+htmlIdIndex).val()*1000)/usdForexs;
                                var priceM2 = ($('#priceM2'+htmlIdIndex).val()*1000)/usdForexs;
                                $('#showPriceTotalVND'+htmlIdIndex).hide();
                                if(totalUSD!=0){
                                    $('#showPriceTotalUSD'+htmlIdIndex).html(format_number(totalUSD,3));
                                }else{
                                    $('#showPriceTotalUSD'+htmlIdIndex).html('N/A');
                                }
                                $('#showPriceTotalUSD'+htmlIdIndex).show();

                                $('#showPriceM2VND'+htmlIdIndex).hide();
                                $('#showPriceM2USD'+htmlIdIndex).html(format_number(priceM2,3));
                                $('#showPriceM2USD'+htmlIdIndex).show();
                                $('#imgVND'+htmlIdIndex).attr('display','none','style');
                                $('#imgUSD'+htmlIdIndex).attr('display','inline','style');

                            }else if(type=='vnd'){
                                $('#showPriceM2USD'+htmlIdIndex).hide();
                                $('#showPriceM2VND'+htmlIdIndex).show();
                                $('#showPriceTotalUSD'+htmlIdIndex).hide();
                                $('#showPriceTotalVND'+htmlIdIndex).show();
                                $('#imgVND'+htmlIdIndex).attr('display','inline','style');
                                $('#imgUSD'+htmlIdIndex).attr('display','none','style');
                            }
                        }
                    </script>
                </div>
            </div>
            <div class="phantrang">
                <div class="pagination1">
                    <?php

                    if($rsProperty['totalPages']>1) {
                        echo paging($rsProperty["page"],$rsProperty["totalPages"],get_link_page('property','cat',$rsProperty["catLink"]));
                    }
                    ?>
                </div>
            </div>
        </div>



    </div>
</div>